﻿using SqlSugar;

namespace VideoPlayer.Entity
{
    [SugarTable("PlaylistItem")]
    public class PlaylistItemDb
    {
        [SugarColumn(IsPrimaryKey = true)]
        public int id { get; set; }

        [SugarColumn(IsNullable = true)]
        public int sort { get; set; }

        [SugarColumn(IsNullable = true)]
        public string hash { get; set; }

        [SugarColumn(IsNullable = true)]
        public string source { get; set; }

        [SugarColumn(IsNullable = true)]
        public string title { get; set; }

        [SugarColumn(IsNullable = true)]
        public string type { get; set; }

        [SugarColumn(IsNullable = true)]
        public int attachment_id { get; set; }

        [SugarColumn(IsNullable = true)]
        public DateTime create_time { get; set; }

        [SugarColumn(IsNullable = true)]
        public int size { get; set; }

        [SugarColumn(IsNullable = true)]
        public string LocalPath { get; set; } = string.Empty;
    }

    public class PlaylistItem
    {
        /// <summary>
        /// 
        /// </summary>
        public int sort { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string hash { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string source { get; set; }
        /// <summary>
        /// 西湖大学云谷校区_穿越实景拍摄.mp4
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string type { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int attachment_id { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public Attachment attachment { get; set; }

        public PlaylistItemDb Convert()
        {
            return new PlaylistItemDb
            {
                sort = sort,
                hash = hash,
                source = source,
                title = title,
                type = type,
                attachment_id = attachment_id,
                create_time = attachment.create_time,
                size = attachment.size,
            };
        }
    }


    public class Attachment
    {
        /// <summary>
        /// 
        /// </summary>
        public int id { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int type { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int state { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string ext { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int size { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string size_w { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string size_h { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int site_id { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int user_id { get; set; }
        /// <summary>
        /// 西湖大学云谷校区_穿越实景拍摄.mp4
        /// </summary>
        public string title { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string description { get; set; }
        /// <summary>
        /// 西湖大学云谷校区_穿越实景拍摄.mp4
        /// </summary>
        public string origin { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string path { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string url { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string hash { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string sha1 { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string source { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public DateTime create_time { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string belong_article { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int synchronism_state { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int enss_type { get; set; }
    }

}